/*
 * Sonatype Nexus (TM) Open Source Version
 * Copyright (c) 2008-present Sonatype, Inc.
 * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
 *
 * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
 * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
 *
 * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
 * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
 * Eclipse Foundation. All other trademarks are the property of their respective owners.
 */
import React from 'react';

import {
  APIConstants,
  ContentBody,
  ExtJS,
  Page,
  PageHeader,
  PageTitle,
} from '@sonatype/nexus-ui-plugin';

import {
  NxH3,
  NxTile,
  NxInfoAlert,
  NxP,
} from '@sonatype/react-shared-components';

import UIStrings from '../../../constants/UIStrings';
import MaliciousRiskOnDisk from '../../widgets/riskondisk/MaliciousRiskOnDisk';
import {faExclamationTriangle} from "@fortawesome/free-solid-svg-icons";
import "./MaliciousRisk.scss";

const {
  TITLE,
  DESCRIPTION,
  MALWARE_REMEDIATION: {DESCRIPTION: MALWARE_DESCRIPTION, REMEDIATION_STEPS, DOWNLOAD_CSV},
  OPEN_SOURCE_MALWARE: {TITLE: OPEN_SOURCE_MALWARE_TITLE, INFO},
} = UIStrings.MALICIOUS_RISK;

const {MALWARE_COMPONENTS_CSV} = APIConstants.REST.PUBLIC;

export default function MalwareRemediation() {
  const downloadCSVUrl = ExtJS.urlOf(MALWARE_COMPONENTS_CSV);

  return (
      <Page className="nxrm-malware-risk">
        <PageHeader>
          <PageTitle icon={faExclamationTriangle} text={TITLE} description={DESCRIPTION}/>
        </PageHeader>
        <ContentBody>
          <NxTile className="nxrm-malware-remediation">
            <NxTile.Content>
              <div className="nxrm-remediation-content">
                <MaliciousRiskOnDisk/>
                <NxP className="nxrm-remediation-description">{MALWARE_DESCRIPTION}</NxP>
                <div className="nxrm-remediation-steps">
                  <NxH3>{REMEDIATION_STEPS.TITLE}</NxH3>
                  <ol>
                    <li>
                      {REMEDIATION_STEPS.FIRST}
                      <a download className="nx-btn nx-btn--tertiary" href={downloadCSVUrl}>{DOWNLOAD_CSV}</a>
                    </li>
                    <li>{REMEDIATION_STEPS.SECOND}</li>
                    <li>{REMEDIATION_STEPS.THIRD}</li>
                  </ol>
                </div>
              </div>
              <div>
                <NxInfoAlert>
                  <NxH3>{OPEN_SOURCE_MALWARE_TITLE}</NxH3>
                  {INFO}
                </NxInfoAlert>
              </div>
            </NxTile.Content>
          </NxTile>
        </ContentBody>
      </Page>
  )
}
